.class public Lde/dealdoktor/app/activities/Search;
.super Lde/dealdoktor/app/activities/SuperListing;
.source "Search.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;
    }
.end annotation


# instance fields
.field private currentPage:I

.field private loadingView:Landroid/view/View;

.field private searchQuery:Ljava/lang/String;

.field private sortByDate:Z


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 28
    invoke-direct {p0}, Lde/dealdoktor/app/activities/SuperListing;-><init>()V

    return-void
.end method

.method static synthetic access$0(Lde/dealdoktor/app/activities/Search;)Landroid/view/View;
    .locals 1
    .parameter

    .prologue
    .line 32
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;

    return-object v0
.end method

.method static synthetic access$1(Lde/dealdoktor/app/activities/Search;)Ljava/lang/String;
    .locals 1
    .parameter

    .prologue
    .line 31
    iget-object v0, p0, Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$2(Lde/dealdoktor/app/activities/Search;)I
    .locals 1
    .parameter

    .prologue
    .line 30
    iget v0, p0, Lde/dealdoktor/app/activities/Search;->currentPage:I

    return v0
.end method

.method static synthetic access$3(Lde/dealdoktor/app/activities/Search;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 30
    iput p1, p0, Lde/dealdoktor/app/activities/Search;->currentPage:I

    return-void
.end method

.method static synthetic access$4(Lde/dealdoktor/app/activities/Search;)Z
    .locals 1
    .parameter

    .prologue
    .line 33
    iget-boolean v0, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    return v0
.end method

.method private refresh(Z)V
    .locals 4
    .parameter "sortByDate"

    .prologue
    const/4 v3, 0x0

    .line 107
    const/4 v1, 0x1

    iput v1, p0, Lde/dealdoktor/app/activities/Search;->currentPage:I

    .line 108
    const v1, 0x7f0b000a

    invoke-virtual {p0, v1}, Lde/dealdoktor/app/activities/Search;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    .line 109
    .local v0, searchText:Landroid/widget/TextView;
    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Suchergebnis f\u00fcr: "

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v2, p0, Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 111
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;

    const v2, 0x7f0b003b

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    invoke-virtual {v1, v3}, Landroid/view/View;->setVisibility(I)V

    .line 112
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;

    const v2, 0x7f0b003d

    invoke-virtual {v1, v2}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    const/16 v2, 0x8

    invoke-virtual {v1, v2}, Landroid/view/View;->setVisibility(I)V

    .line 113
    iget-object v1, p0, Lde/dealdoktor/app/activities/Search;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    invoke-virtual {v1}, Lde/dealdoktor/app/adapter/PostListAdapter;->clear()V

    .line 115
    new-instance v1, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;

    invoke-direct {v1, p0, p1}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;-><init>(Lde/dealdoktor/app/activities/Search;Z)V

    new-array v2, v3, [Ljava/lang/String;

    invoke-virtual {v1, v2}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 116
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 6
    .parameter "savedInstanceState"

    .prologue
    const/4 v5, 0x0

    .line 37
    invoke-super {p0, p1}, Lde/dealdoktor/app/activities/SuperListing;->onCreate(Landroid/os/Bundle;)V

    .line 38
    const v2, 0x7f030007

    invoke-virtual {p0, v2}, Lde/dealdoktor/app/activities/Search;->setContentView(I)V

    .line 40
    iput-boolean v5, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    .line 42
    const/4 v2, 0x1

    iput v2, p0, Lde/dealdoktor/app/activities/Search;->currentPage:I

    .line 43
    invoke-virtual {p0}, Lde/dealdoktor/app/activities/Search;->getIntent()Landroid/content/Intent;

    move-result-object v2

    const-string v3, "query"

    invoke-virtual {v2, v3}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;

    .line 45
    const v2, 0x7f0b000a

    invoke-virtual {p0, v2}, Lde/dealdoktor/app/activities/Search;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/TextView;

    .line 46
    .local v1, searchText:Landroid/widget/TextView;
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Suchergebnis f\u00fcr: "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v3, p0, Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 49
    const v2, 0x7f0b0009

    invoke-virtual {p0, v2}, Lde/dealdoktor/app/activities/Search;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ListView;

    iput-object v2, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    .line 51
    const-string v2, "layout_inflater"

    invoke-virtual {p0, v2}, Lde/dealdoktor/app/activities/Search;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/LayoutInflater;

    .line 52
    .local v0, infl:Landroid/view/LayoutInflater;
    const v2, 0x7f030012

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v2

    iput-object v2, p0, Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;

    .line 55
    iget-object v2, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    iget-object v3, p0, Lde/dealdoktor/app/activities/Search;->loadingView:Landroid/view/View;

    invoke-virtual {v2, v3}, Landroid/widget/ListView;->addFooterView(Landroid/view/View;)V

    .line 58
    new-instance v2, Lde/dealdoktor/app/adapter/PostListAdapter;

    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    iget-object v4, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    invoke-direct {v2, v3, p0, v4}, Lde/dealdoktor/app/adapter/PostListAdapter;-><init>(Ljava/util/ArrayList;Lde/dealdoktor/app/activities/SuperListing;Landroid/widget/ListView;)V

    iput-object v2, p0, Lde/dealdoktor/app/activities/Search;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    .line 59
    iget-object v2, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    iget-object v3, p0, Lde/dealdoktor/app/activities/Search;->listAdapter:Lde/dealdoktor/app/adapter/PostListAdapter;

    invoke-virtual {v2, v3}, Landroid/widget/ListView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 62
    iget-object v2, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    new-instance v3, Lde/dealdoktor/app/activities/Search$1;

    invoke-direct {v3, p0}, Lde/dealdoktor/app/activities/Search$1;-><init>(Lde/dealdoktor/app/activities/Search;)V

    invoke-virtual {v2, v3}, Landroid/widget/ListView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 74
    new-instance v2, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;

    iget-boolean v3, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    invoke-direct {v2, p0, v3}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;-><init>(Lde/dealdoktor/app/activities/Search;Z)V

    new-array v3, v5, [Ljava/lang/String;

    invoke-virtual {v2, v3}, Lde/dealdoktor/app/activities/Search$GetSearchResultsTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    .line 77
    iget-object v2, p0, Lde/dealdoktor/app/activities/Search;->results:Landroid/widget/ListView;

    new-instance v3, Lde/dealdoktor/app/activities/Search$2;

    invoke-direct {v3, p0}, Lde/dealdoktor/app/activities/Search$2;-><init>(Lde/dealdoktor/app/activities/Search;)V

    invoke-virtual {v2, v3}, Landroid/widget/ListView;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 94
    return-void
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 171
    invoke-virtual {p0}, Lde/dealdoktor/app/activities/Search;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    .line 172
    .local v0, inflater:Landroid/view/MenuInflater;
    const v1, 0x7f0a0001

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 173
    const/4 v1, 0x1

    return v1
.end method

.method protected onNewIntent(Landroid/content/Intent;)V
    .locals 2
    .parameter "intent"

    .prologue
    .line 98
    const-string v0, "xxx"

    const-string v1, "test"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 99
    invoke-super {p0, p1}, Lde/dealdoktor/app/activities/SuperListing;->onNewIntent(Landroid/content/Intent;)V

    .line 101
    const-string v0, "query"

    invoke-virtual {p1, v0}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lde/dealdoktor/app/activities/Search;->searchQuery:Ljava/lang/String;

    .line 103
    iget-boolean v0, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    invoke-direct {p0, v0}, Lde/dealdoktor/app/activities/Search;->refresh(Z)V

    .line 104
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 3
    .parameter "item"

    .prologue
    const/4 v2, 0x0

    const/4 v0, 0x1

    .line 178
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    packed-switch v1, :pswitch_data_0

    .line 188
    invoke-super {p0, p1}, Lde/dealdoktor/app/activities/SuperListing;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v0

    :goto_0
    return v0

    .line 180
    :pswitch_0
    iput-boolean v2, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    .line 181
    invoke-direct {p0, v2}, Lde/dealdoktor/app/activities/Search;->refresh(Z)V

    goto :goto_0

    .line 184
    :pswitch_1
    iput-boolean v0, p0, Lde/dealdoktor/app/activities/Search;->sortByDate:Z

    .line 185
    invoke-direct {p0, v0}, Lde/dealdoktor/app/activities/Search;->refresh(Z)V

    goto :goto_0

    .line 178
    :pswitch_data_0
    .packed-switch 0x7f0b004b
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onSearchRequested()Z
    .locals 1

    .prologue
    .line 166
    invoke-super {p0}, Lde/dealdoktor/app/activities/SuperListing;->onSearchRequestedSuper()Z

    move-result v0

    return v0
.end method
